﻿#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using BreakOutBattles.Game;
using Microsoft.Xna.Framework.Graphics;
using BreakOutBattles.Game.Events;
#endregion

namespace BreakOutBattles.Menus
{
    /// <summary>
    /// The pause menu of the game.
    /// </summary>
    public class PauseMenu : Menu
    {
        public delegate void QuitEventHandler(QuitEventArgs args);
        public event QuitEventHandler QuitEvent;


        public PauseMenu(Microsoft.Xna.Framework.Game game, SpriteBatch spriteBatch)
            : base(game, spriteBatch)
        { }

        /// <summary>
        /// Creates the menu items of this menu.
        /// </summary>
        public override void CreateMenu()
        {
            menuItems.Add(new MenuItem("Resume", new Vector2(500, 200), new Action(ResumeAction)));
            menuItems.Add(new MenuItem("Quit", new Vector2(500, 300), new Action(QuitAction)));
        }


        #region Menu Actions
        /// <summary>
        /// Resumes the game. Triggered when the player hits the resume button.
        /// </summary>
        public void ResumeAction()
        {
            GameState.CurrentState = GameStates.GAME_RUNNING;
        }

        /// <summary>
        /// Attempts to quit the game. Triggered when the player hits the quit button.
        /// </summary>
        public void QuitAction()
        {
            if (QuitEvent != null)
            {
                QuitEvent(new QuitEventArgs());
            }

            GameState.CurrentState = GameStates.MENU;
        }
        #endregion
    }
}
